<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list"
    style="padding: 20px 30px 0 0;">
    <div class="layui-card">

        <div class="layui-card-header">新人优惠券设置</div>

        <div class="layui-card-body"></div>
        <script type='text/html' template lay-done='layui.data.formdone(d.params);'>
            <input type='hidden' name='PID' value="{{ d.params.PID || '' }}"/>
        </script>

        <div class='layui-form-item'>
            <label class='layui-form-label'>优惠卷标题<label style="color: red">*</label></label>
            <div class='layui-input-inline'>
                <script type='text/html' template>
                <input type='text' name='Title' value='{{ d.params.Title || '' }}' lay-verify='required' placeholder='优惠卷标题'  autocomplete='off' class='layui-input'>
            </script>
            </div>
        </div>

        <div class='layui-form-item'>
            <label class='layui-form-label'>使用条件 <label style="color: red">*</label></label>
            <div class='layui-input-block'>
                <div class='layui-input-inline'>
                    <script type='text/html' template>
                    <select name='Use_Sel' lay-verify='required' >
                      <option value='0' {{ d.params.Use_Sel == '0' ? 'selected' : '' }}>满减</option>
                      <option value='1' {{ d.params.Use_Sel == '1' ? 'selected' : '' }}>无门槛</option>
                    </select>
                </script>
                </div>
            </div>
        </div>

        <div class='layui-form-item'>
            <label class='layui-form-label'>门槛金额<label style="color: red">*</label></label>
            <div class='layui-input-inline'>
                <script type='text/html' template>
                <input type='text' name='SillPrice' value='{{ d.params.SillPrice || '' }}' lay-verify='required'  placeholder='门槛金额(可以填写0元)' autocomplete='off' class='layui-input'>
              
            </script>
            </div>
        </div>

        <div class='layui-form-item'>
            <label class='layui-form-label'>优惠卷面额<label style="color: red">*</label></label>
            <div class='layui-input-inline'>
                <script type='text/html' template>
                <input type='text' name='Price' value='{{ d.params.Price || '' }}' lay-verify='required|number' placeholder='优惠卷面额' autocomplete='off' class='layui-input'>   
            </script>
            </div>
        </div>

        <div class='layui-form-item'>
            <label class='layui-form-label'>新人优惠券组代码</label>
            <div class='layui-input-inline'>
                <script type='text/html' template>
                <input type='text' name='CouponCode' value='{{ d.params.CouponCode || '' }}'  placeholder='新人优惠券组代码' autocomplete='off' class='layui-input'>
            </script>
            </div>
        </div>

        <div class='layui-form-item'>
            <label class='layui-form-label'>发放开始时间<label style="color: red">*</label></label>
            <div class='layui-input-inline'>
                <script type='text/html' template lay-done='layui.data.datedone(d.params);'>
                    <input type='text' name='GrantStartTime' readonly='readonly' id='GrantStartTime' value='{{ d.params.GrantStartTime || '' }}' lay-verify='required|datetime' placeholder='yyyy-MM-dd HH:mm:ss' autocomplete='off' class='layui-input'>
                </script>
            </div>
    
            <label class='layui-form-label'>发放结束时间<label style="color: red">*</label></label>
            <div class='layui-input-inline'>
                <script type='text/html' template lay-done='layui.data.datedone(d.params);'>
                    <input type='text' name='GrantEndTime' readonly='readonly' id='GrantEndTime' value='{{ d.params.GrantEndTime || '' }}' lay-verify='required|datetime' placeholder='yyyy-MM-dd HH:mm:ss' autocomplete='off' class='layui-input'>
                </script>
            </div>
        </div>
    
    
        <div class='layui-form-item'>
    
            <label class='layui-form-label'>发放数量<label style="color: red">*</label></label>
            <div class='layui-input-inline'>
                <script type='text/html' template>
                    <input type='text' name='GrantNum' value='{{ d.params.GrantNum || '' }}' lay-verify='required|number' placeholder='发放数量' autocomplete='off' class='layui-input'>
                </script>
            </div>
    
    
            <label class='layui-form-label'>限领数量<label style="color: red">*</label></label>
            <div class='layui-input-inline'>
                <script type='text/html' template>
                    <input type='text' name='LimitNum' value='{{ d.params.LimitNum || '' }}' lay-verify='required|number' placeholder='限领数量' autocomplete='off' class='layui-input'>
                </script>
            </div>
        </div>

        <div class='layui-form-item'>
            <label class='layui-form-label'>是否公开</label>
            <div class='layui-input-block'>
                <div class='layui-input-inline'>
                    <script type='text/html' template>
                        <select name='IsOpen_Sel'>
                          <option value='0' {{ d.params.IsOpen_Sel == '0' ? 'selected' : '' }}>公开</option>
                          <option value='1' {{ d.params.IsOpen_Sel == '1' ? 'selected' : '' }}>不公开</option>
                        </select>
                    </script>
                </div>
            </div>
        </div>
    
        <div class='layui-form-item'>
            <label class='layui-form-label'>生效时间<label style="color: red">*</label></label>
            <div class='layui-input-inline'>
                <script type='text/html' template lay-done='layui.data.datedone(d.params);'>
                    <input type='text' name='UseStartTime' readonly='readonly' id='UseStartTime'  value='{{ d.params.UseStartTime || '' }}' lay-verify='required|datetime' placeholder='yyyy-MM-dd HH:mm:ss' autocomplete='off' class='layui-input'>
                </script>
            </div>
    
            <label class='layui-form-label'>截止时间<label style="color: red">*</label></label>
            <div class='layui-input-inline'>
                <script type='text/html' template lay-done='layui.data.datedone(d.params);'>
                    <input type='text' name='UseEndTime' readonly='readonly' id='UseEndTime' value='{{ d.params.UseEndTime || '' }}' lay-verify='required|datetime' placeholder='yyyy-MM-dd HH:mm:ss' autocomplete='off' class='layui-input'>
                </script>
            </div>
        </div>




        <div class='layui-form-item'>
            <label class='layui-form-label'>优惠卷状态 </label>
            <div class='layui-input-block'>
                <div class='layui-input-inline'>
                    <script type='text/html' template>
                        <select name='State_Sel'>
                          <option value='0' {{ d.params.State_Sel == '0' ? 'selected' : '' }}>待激活</option>
                          <option value='1' {{ d.params.State_Sel == '1' ? 'selected' : '' }}>激活</option>
                          <option value='2' {{ d.params.State_Sel == '2' ? 'selected' : '' }}>冻结</option>
                          <option value='3' {{ d.params.State_Sel == '3' ? 'selected' : '' }}>回收</option>
                        </select>
                    </script>
                </div>
            </div>
        </div>

        <div class='layui-form-item'>
            <label class='layui-form-label'>有效时间(天)</label>
            <div class='layui-input-inline'>
                <script type='text/html' template>
                <input type='text' name='CouponDay' value='{{ d.params.CouponDay || '' }}' lay-verify='required|number'  placeholder='有效时间' autocomplete='off' class='layui-input'>
            </script>
            </div>
        </div>


        <div class='layui-form-item'>
            <label class='layui-form-label'>优惠卷描述</label>
            <div class='layui-input-inline'>
                <script type='text/html' template>
                    <input type='text' name='Description' value='{{ d.params.Description || '' }}'  placeholder='优惠卷描述' autocomplete='off' class='layui-input'>
                </script>
            </div>
        </div>

        <div class='layui-form-item'>
            <label class='layui-form-label'>备注</label>
            <div class='layui-input-inline'>
                <script type='text/html' template>
                <textarea  type='text' name='RMK' value='{{ d.params.RMK || '' }}'  placeholder='备注' autocomplete='off' class='layui-textarea'>
            </script>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-inline">
                <input type="button" lay-submit lay-filter="layuiadmin-app-form-submit" value="确认" class="layui-btn">
            </div>
        </div>
    </div>
</div>


<script type="text/javascript">

    layui.use(['form', 'admin', 'upload', 'laydate', 'formSelects'], function () {
        var form = layui.form;//required（必填项）phone（手机号）email（邮箱）url（网址）number（数字）date（日期）identity（身份证） 自定义值
        var $ = layui.$;
        var admin = layui.admin;

        // form.on('submit(layuiadmin-app-form-submit)', function (data1) {
        //     admin.req({
        //         url: layui.setter.APIUrl + '/WebAPI/coupon/editnewCoupon', //实际使用请改成服务端真实接口
        //         type: 'post',
        //         data: data1.field,
        //         done: function (res) {
        //             layer.msg('成功');
        //         }
        //     });
        // });

        // admin.req({
        //     url: layui.setter.APIUrl + '/WebAPI/coupon/getnewCouponbyBack', //实际使用请改成服务端真实接口
        //     type: 'post',
        //     done: function (res) {
        //         form.val("layuiadmin-app-form-list",res.Data);
        //     }
        // });
    });



    layui.data.formdone = function (d) {
        var $ = layui.$;
        var admin = layui.admin;
        var form = layui.form;
     
    };


    layui.data.datedone = function (d) {
        layui.use(['laydate'], function () {
            var laydate = layui.laydate;

            //日期时间选择器
            laydate.render({
                elem: '#GrantStartTime'
                , type: 'datetime'
                , calendar: true
            });
            laydate.val = d.GrantStartTime;

            //日期时间选择器
            laydate.render({
                elem: '#GrantEndTime'
                , type: 'datetime'
                , calendar: true
            });
            laydate.val = d.GrantEndTime;

            //日期时间选择器
            laydate.render({
                elem: '#UseStartTime'
                , type: 'datetime'
                , calendar: true
            });
            laydate.val = d.UseStartTime;

            //日期时间选择器
            laydate.render({
                elem: '#UseEndTime'
                , type: 'datetime'
                , calendar: true
            });
            laydate.val = d.UseEndTime;

        });
    }   




</script>